package com.example.bigevent.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> implements Serializable {
    private Integer code;
    private String message;
    private T data;

    public static  Result<String> success(){
        return new Result<>(1,"操作成功",null);
    }


    public static  <T> Result<T> success(T data){
        return new Result<>(1,"操作成功",data);
    }

    public static  Result<String> error(){
        return new Result<>(0,"操作失败",null);
    }

    public static  <T> Result<T> error(T data){
        return new Result<>(0,"操作失败",data);
    }
}
